/**
 * 
 */
package com.seraph.zys.web.system;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.seraph.bi.suite.support.core.resources.LocalResourcesManager;
import com.seraph.bi.suite.support.web.json.JsonProviderController;

/**
 * 类说明: 系统参数数据提供<br>
 * 创建时间: 2008-8-27 上午10:29:48<br>
 * 
 * @author 刘岩松<br>
 * @email: seraph115@gmail.com<br>
 */
@Controller
@RequestMapping("/systemParmsProvider.do")
public class SystemParmsProviderController extends JsonProviderController {

	private LocalResourcesManager localResourcesManager;

	public void setLocalResourcesManager(
			LocalResourcesManager localResourcesManager) {
		this.localResourcesManager = localResourcesManager;
	}

	@SuppressWarnings("unchecked")
	@RequestMapping(method = { RequestMethod.POST })
	protected Object handleJsonRequest(HttpServletRequest request,
			HttpServletResponse response) {

		List list = new ArrayList();
		String type = request.getParameter("type");
		type = type.toUpperCase();

		List result = localResourcesManager.getCodeInfoListByType(type);
		if (result != null) {
			list = result;
		}

		return list;
	}

}
